<?php
class Block_BlkSpecial extends Zend_View_Helper_Abstract{

	public function blkSpecial(){
		
		$view  = $this->view;
		$arrParam = $view->arrParam;
		$currentPage = $arrParam['paginator']['currentPage'];
		$flagShow  = false;
		if($arrParam['action'] == 'index' && $currentPage < 2){
			$flagShow  = true;
		}
		
		if($flagShow == true ){
			$db = Zend_Registry::get('connectDb');
			$select = $db->select()
						 ->from('products as p',array('id','name','picture','price','selloff','cat_id'))
						 ->join('product_category as pc','pc.id = p.cat_id',array('name as category_name'))
						 ->where('p.special = 1')
						 ->limit(4,0)
						 ->order(' RAND()');
			$rows = $db->fetchAll($select);
			
			require_once (BLOCK_PATH . '/BlkSpecial/default.php');
		}
	}
}